﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ECCIT;
using ECCIT.Data;
using OgilvyOne.Model;
using OgilvyOne.IDAL;
using OgilvyOne.DALFactory;

using System.Data;


namespace OgilvyOne.BLL
{

    public class UserBLL
    {
        IDALUser hander = DALFactory.UserDALFactory.Creat();
        /// <summary>
        /// 将Xml字符串存入表中
        /// </summary>
        /// <param name="sb">Xml字符串</param>
        /// <param name="guid">guid</param>
        /// <returns></returns>
        public int Save(StringBuilder sb, string guid, string lang)
        {
            hander.DeleXml(guid);
            return hander.SaveXml(sb, guid, lang);
        }
        /// <summary>
        /// 获取xml
        /// </summary>
        /// <param name="guid">guid</param>
        /// <returns>值</returns>
        public string GerXml(string guid)
        {
            return hander.GetXml(guid);
        }

        public int SaveMail(string surName, string presonalName, string toMail1, string toMail2, string toMail3, string lang, string friendName1, string friendName2, string friendName3, string userEmail, string mobile)
        {
            int flag = hander.SaveSendMail(surName, presonalName, toMail1, toMail2, toMail3, lang, friendName1, friendName2, friendName3,userEmail,mobile);
           return flag;
        }

        /// <summary>
        /// 检查email是否存在
        /// </summary>
        /// <param name="email">邮箱</param>
        /// <returns>存在返回1 不存在返回0</returns>
        public int IsExist(string email)
        {
            int flag = hander.IsExist(email);
            return flag;
        }

        public DataTable GetExcel(string startTime,string endTime)
        {
            return hander.GetExcel(startTime, endTime);
        }

        public int SaveContacUs(string title, string name, string email, string country, string message, string lang)
        {
            return hander.SaveContacUs(title, name, email, country, message, lang);
        }

        /// <summary>
        /// 验证contactUs邮箱
        /// </summary>
        /// <param name="email"></param>
        /// <returns>成功 1 失败 0</returns>
        public int CheckEmailOfContacUs(string email)
        {
            return hander.CheckEmailOFContacUs(email);
        }
    }
}
